package com.app.aipass.view;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.app.aipass.R;
import com.app.aipass.entity.WalletTypeEntity;

import java.util.List;

/**
 * @author: woking
 * @date: 2021/6/18
 * @description：
 */
public class WalletTypesAdapter extends BaseAdapter {
    private List<WalletTypeEntity> mDatas = null;
    private Context mContext = null;

    public WalletTypesAdapter(Context context, List<WalletTypeEntity> datas) {
        mDatas = datas;
        mContext = context;
    }

    @Override
    public int getCount() {
        return mDatas.size();
    }

    @Override
    public Object getItem(int i) {
        return mDatas.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder vh;
        if (view == null) {
            vh = new ViewHolder();
            view = LayoutInflater.from(mContext).inflate(R.layout.item_wallettype_list, null);
//            vh.id = (TextView) view.findViewById(R.id.total_tv);
            vh.name = (TextView) view.findViewById(R.id.total_tv);
//            vh.phone = (TextView) view.findViewById(R.id.sai_phone);
            view.setTag(vh);
        } else {
            vh = (ViewHolder) view.getTag();
        }
//        vh.id.setText(mDatas.get(i).id);
        vh.name.setText(mDatas.get(i).title);
//        vh.phone.setText(mDatas.get(i).phone);

        return view;
    }

    public final class ViewHolder {
//        public TextView id;
        public TextView name;
//        public TextView phone;
    }
}